import React, { useState, useEffect } from 'react'
import api from "../../../api"
import DetailsInfoView from "../DetailsInfoView"


export default function DetailsInfo ({ id }) {

  const [detailsData, setDetailsData] = useState({})

  useEffect(() => {
    api.details({ id }).then(res => {
      console.log(res.data);
      if (res.data.status === 200) {
        setDetailsData(res.data.result)
      }
    }).catch(error => {
      console.log(error);
    })
  }, [])
  return (
    <div>
      {
        detailsData.imgs ? <DetailsInfoView data={detailsData} id={id} /> :
          <div>等待数据加载</div>
      }
    </div>
  )
}
